//
//  StatusTool.m
//  CC
//
//  Created by Calvin on 5/19/15.
//  Copyright (c) 2015 Calvin. All rights reserved.
//

#import "StatusTool.h"
#import "HomeStatusesParam.h"
#import "HomeStatusesResult.h"
#import "MJExtension.h"
#import "HttpTool.h"
#import "SendStatusesParam.h"
#import "SendStatusesResult.h"

@implementation StatusTool
+(void)homeStatusesWithParam:(HomeStatusesParam *)param success:(void (^)(HomeStatusesResult *))success failure:(void (^)(NSError *))failure
{
//    NSDictionary *params = param.keyValues;
//    [HttpTool get:@"https://api.weibo.com/2/statuses/home_timeline.json" params:params success:^(id responseObj) {
//        if (success) {
//            HomeStatusesResult *result = [HomeStatusesResult objectWithKeyValues:responseObj];
//            NSLog(@"%@",result);
//            success(result);
//        }
//    } failure:^(NSError *error) {
//        if (failure) {
//            failure(error);
//        }
//    }];
    [self getWithUrl:@"https://api.weibo.com/2/statuses/home_timeline.json" param:param resultClass:[HomeStatusesResult class] success:success failure:failure];
}

+(void)sendStatusesWithParam:(SendStatusesParam *)param success:(void (^)(SendStatusesResult *))success failure:(void (^)(NSError *))failure
{
//    NSDictionary *params = param.keyValues;
//    [HttpTool post:@"https://api.weibo.com/2/statuses/update.json" params:params success:^(id responseObj) {
//        if (success) {
//            SendStatusesResult *result = [SendStatusesResult objectWithKeyValues:responseObj];
//            success(result);
//        }
//    } failure:^(NSError *error) {
//        if (failure) {
//            failure(error);
//        }
//    }];
    [self postWithUrl:@"https://api.weibo.com/2/statuses/update.json" param:param resultClass:[HomeStatusesResult class] success:success failure:failure];
}
@end
